package com.e.dianshang.service.impl;

import com.e.dianshang.mapper.GoodsClassTwoMapper;
import com.e.dianshang.service.GoodsClassTwoService;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: HP
 * Date: 2020/11/11 18:57
 * Description:
 */
@Data
@NoArgsConstructor
@Service("GoodsClassTwoService")
public class GoodsClassTwoServiceImpl implements GoodsClassTwoService {

    @Resource
    GoodsClassTwoMapper goodsClassTwoMapper;


    @Override
    public List<Map> getClassTwoAndThree(Integer classOneId) {

        List<Map> classTwo = goodsClassTwoMapper.getClassTwo(classOneId);
        for (Map map1 : classTwo) {
            Integer classTwoId = (Integer) map1.get("gt2_id");
            List<Map> classThree = goodsClassTwoMapper.getClassThree(classOneId,classTwoId);
            map1.put("classThree",classThree);
        }


        return classTwo;
    }
}
